import _thread
import time
import urllib.request
import json


def print_time(postData,delay):
    url = "http://www.babei.com/api/v1/orderadd"
    count = 0
    while count < 100:
        count += 1
        data = urllib.parse.urlencode(postData).encode(encoding='UTF8')
        response = urllib.request.urlopen(url, data)
        print(count)
        print (response.read())


try:
    _thread.start_new_thread(print_time,({"order_money":"437","reward_id":"0","is_machine":0,"address":1,"order_type":"1","pay_type":"0"},0))
    # _thread.start_new_thread(print_time, (
    # {"order_money": "437", "reward_id": "0", "is_machine": 0, "address": 1, "order_type": "1", "pay_type": "0"}, 0))
    # _thread.start_new_thread(print_time, (
    # {"order_money": "437", "reward_id": "0", "is_machine": 0, "address": 1, "order_type": "1", "pay_type": "0"}, 0))
    # _thread.start_new_thread(print_time, (
    # {"order_money": "437", "reward_id": "0", "is_machine": 0, "address": 1, "order_type": "1", "pay_type": "0"}, 0))
    # _thread.start_new_thread(print_time, (
    # {"order_money": "437", "reward_id": "0", "is_machine": 0, "address": 1, "order_type": "1", "pay_type": "0"}, 0))
    # _thread.start_new_thread(print_time, (
    # {"order_money": "437", "reward_id": "0", "is_machine": 0, "address": 1, "order_type": "1", "pay_type": "0"}, 0))
except:
    print("Error: 无法启动线程")

while 1:
    pass